import axios from '@/http/index'

export function getRoles(currentPage = 1, take = 10, filter) {
  return axios({
    url: '/api/identity/roles',
    method: 'get',
    params: {
      skipCount: take * (currentPage - 1),
      maxResultCount: take,
      filter
    }
  })
}

export function addRole(data) {
  return axios({
    url: '/api/identity/roles',
    method: 'post',
    data
  })
}

export function editRole(id, data) {
  return axios({
    url: `/api/identity/roles/${id}`,
    method: 'put',
    data
  })
}

export function deleteRole(id) {
  return axios({
    url: `/api/identity/roles/${id}`,
    method: 'delete'
  })
}
